<!--
 * @Author: Hugh Xie
 * @Date: 2022-04-05 20:04:02
 * @LastEditors: Hugh Xie
 * @LastEditTime: 2022-05-08 19:46:17
 * @FilePath: \frontend\src\view\student\student-bop-manage\modal\light-detail.vue
-->
<template>
  <div>
    <a-row>
      <a-col :span="24">
        <pro-table
          ref="tableRef"
          :pagination="pagination"
          :fetch="fetch"
          :columns="tableConfig.columns"
          :param="state.param"
          :toolbar="toolbar"
          :defaultToolBar="false"
        />
        <save v-if="state.visibleSave" ref="savemodal" :parent="state.parentData" :visible="state.visibleSave" @close="closeSave"></save>
      </a-col>
    </a-row>
  </div>
</template>

<script>
import save from "./save-follow";
import { handleFormEmptyData } from "@/tools/filters";
import { reactive, ref, onMounted } from "vue";
import { useRouter } from "vue-router";
import { getDictByCodesReturnObj } from '@/tools/get-dict'
import dictEnum from '@/const/dict'
import moment from 'moment'
import {
  followPage
} from "@/api/module/student/student-bop-manage";

export default {
  props: {
    params: {
      type: Array,
      default: () => []
    }
  },
  components: {
    save
  },
  name: "index",

  setup(props, content) {
    const tableRef = ref();
    const savemodal = ref();
    const router = useRouter();
    const pagination = {
      pageNum: 1,
      pageSize: 10,
    };
    let dictLists = reactive({
      data: {}
    })
    const fetch = async (param) => {
      // param.buspId = props.params.id || ''
      // const response = await followPage(param)
      return {
        // data: response.record || [],
        // total: response.total || 0
        data: [],
        total: 0
      };
    };
    const toolbar = [
      // {
      //   code: "college-manage:add",
      //   label: "新增",
      //   type: "primary",
      //   event: function() {
      //     state.visibleSave = true;
      //   }
      // }
    ];

    const tableConfig = reactive({
      columns: [
        {
          dataIndex: "cussRemark",
          key: "cussRemark",
          title: "学年",
          align: "left"
        },
        {
          dataIndex: "cussRemark",
          key: "cussRemark",
          title: "季度",
          align: "left"
        },
        {
          dataIndex: "cussRemark",
          key: "cussRemark",
          title: "项目学校",
          align: "left"
        },
        {
          dataIndex: "cussRemark",
          key: "cussRemark",
          title: "课程名称",
          align: "left"
        },
        {
          dataIndex: "cussRemark",
          key: "cussRemark",
          title: "学校班级代码",
          align: "left"
        },
        {
          dataIndex: "cussRemark",
          key: "cussRemark",
          title: "教务负责人",
          align: "left"
        },
        {
          dataIndex: "cussRemark",
          key: "cussRemark",
          title: "订单编号",
          align: "left"
        },
        {
          dataIndex: "cussRemark",
          key: "cussRemark",
          title: "订单创建人",
          align: "left"
        },
        {
          dataIndex: "cussRemark",
          key: "cussRemark",
          title: "缴费状态",
          align: "left"
        },
        {
          dataIndex: "cussRemark",
          key: "cussRemark",
          title: "认证状态",
          align: "left"
        },
        {
          dataIndex: "cussRemark",
          key: "cussRemark",
          title: "课程状态",
          align: "left"
        },
        {
          dataIndex: "cussRemark",
          key: "cussRemark",
          title: "成绩寄送单状态",
          align: "left"
        },
        {
          dataIndex: "cussRemark",
          key: "cussRemark",
          title: "转学分状态",
          align: "left"
        },
      ],
      operate: [
        // {
        //   code: 'college-manage:follow-remove',
        //   label: "删除",
        //   event: (item) => {
        //     Modal.confirm({
        //       title: "你需要删除该数据吗？",
        //       okText: "是",
        //       okType: "danger",
        //       cancelText: "否",
        //       onOk() {
        //         delFollowUpRecord(item.id).then((response) => {
        //           if (response.success) {
        //             message.success({ content: "删除成功" });
        //             tableRef.value.reload();
        //             content.emit('refresh')
        //           } else {
        //             message.error({ content: "删除失败" });
        //           }
        //         });
        //       },
        //     });
        //   },
        // },
      ],
    });
    const goNewSchool = () => router.push("/university/college-manage/add");
    const state = reactive({
      selectedRowKeys: [],
      param: {},
      visibleSave: false,
      visibleEdit: false,
      visibleInfo: false,
      recordEdit: {},
      recordInfo: {},
      parentData: props.params,
      currentRow: {}
    });
    const closeSave = function(row) {
      state.visibleSave = false;
      tableRef.value.reload();
    };
    const onSelectChange = selectedRowKeys => {
      state.selectedRowKeys = selectedRowKeys;
    };
    onMounted(async () => {
      dictLists.data = await getDictByCodesReturnObj([
        dictEnum.STU_FOLLOW_STATE,
      ])
      tableRef.value.reload();
    })
    return {
      savemodal,
      fetch,
      closeSave,
      toolbar,
      pagination,
      state,
      tableConfig,
      onSelectChange,
      tableRef,
      handleFormEmptyData,
    };
  }
};
</script>

<style scoped></style>
